# 定义抽象工厂接口
class AbstractFactory:
    def create_product1(self):
        pass

    def create_product2(self):
        pass

# 定义具体工厂1
class ConcreteFactory1(AbstractFactory):
    def create_product1(self):
        return ConcreteProduct1()

    def create_product2(self):
        return ConcreteProduct2()

# 定义具体工厂2
class ConcreteFactory2(AbstractFactory):
    def create_product1(self):
        return ConcreteProduct1()

    def create_product2(self):
        return ConcreteProduct2()

# 定义抽象产品接口
class AbstractProduct1:
    def useful_function_a(self):
        pass

class AbstractProduct2:
    def useful_function_b(self):
        pass

# 定义具体产品1
class ConcreteProduct1(AbstractProduct1):
    def useful_function_a(self):
        return "The result of the product A1."

# 定义具体产品2
class ConcreteProduct2(AbstractProduct2):
    def useful_function_b(self):
        return "The result of the product B1."

# 定义客户端代码
def client_code(factory):
    product1 = factory.create_product1()
    product2 = factory.create_product2()

    print(f"{product1.useful_function_a()}")
    print(f"{product2.useful_function_b()}")

# 使用具体工厂1
print("Client: Testing the first factory type:")
client_code(ConcreteFactory1())

# 使用具体工厂2
print("Client: Testing the second factory type:")
client_code(ConcreteFactory2())